<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script>
    <script src="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/axios/0.21.1/axios.min.js"></script>
    <title>Document</title>
</head>
<body>
    <!-- fetch请求  es6 -->
    <div id="app">{{list}}</div>

    <script>
        new Vue({
            el:'#app',
            data(){
                return{
                    list:[]
                }
            },
            mounted(){
             /*  fetch("http://192.168.3.190:7001/api/advertisement").then(res=>{ 
                 return res.json()
                }).then(res=>{
                    //console.log(res);
                    if(res.code===0){
                        this.list=res.data
                    }else{
                        alert(res.msg)
                    }
                }) */
             axios.get("http://192.168.3.190:7001/api/advertisement").then(res=>{
                 const row=res.data;
                 if(row.code===0){
                        this.list=row.data
                    }else{
                        alert(row.msg)
                    }
             })
            }
        })
        //相当于ajax
    </script>
</body>
</html>